package com.dingteam.question.common.enums;

import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 问答控件的类型
 * @author Jamin
 * @date 2019/07/11
 */
@Getter
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public enum TextTypeEnum {

	/** 文本 */
	TEXT(1, "text"),
	/** 数字可以包括小数点 */
	NUMBER(2, "number"),
	/** 手机号 */
	TELEPHONE(3, "telephone"),
	/** 电子邮箱 */
	EMAIL(4, "email"),
	;

	private Integer type;

	private String alias;

	public static TextTypeEnum valueOfAlias(String alias) {
		for (TextTypeEnum value : TextTypeEnum.values()) {
			if (value.getAlias().equals(alias)) {
				return value;
			}
		}
		throw new IllegalArgumentException("alias illegal:" + alias);
	}

}
